set(include_dir
    ${CMAKE_CURRENT_SOURCE_DIR}/
    ${CMAKE_CURRENT_SOURCE_DIR}/../third/cJSON
    ${CMAKE_CURRENT_SOURCE_DIR}/../third/curl/include
)

set(libs_dir
    ${CMAKE_CURRENT_SOURCE_DIR}/../build/third/cJSON/
    ${CMAKE_CURRENT_SOURCE_DIR}/../build/third/curl/lib/
)

message("CMAKE_BUILD_TYPE IS ${CMAKE_BUILD_TYPE}")

if(CMAKE_BUILD_TYPE STREQUAL "Debug")
    message("USING \"Debug\"")
    set(dep_libs
        cjson
        curl-d
        pthread
    )
else()
    message("USING \"Release\"")
    set(dep_libs
        cjson
        curl
        pthread
    )
endif(CMAKE_BUILD_TYPE STREQUAL "Debug")

include_directories(${include_dir})
link_directories(${libs_dir})
link_libraries(${dep_libs})

file(GLOB C_SOURCE_FILE "*.c")

add_executable(cicd_service ${C_SOURCE_FILE})

install(TARGETS cicd_service DESTINATION ${INSTALL_DIR})